#include "Sight.h"

Sight::Sight(void)
{
	_x = 0;
	_y = 0;
}

Sight::Sight(float x, float y, int _deltaTime, int resourceName, CResourceManager *rm)
{
	_x = x;
	_y = y;
	_sprite = rm->getSprite(resourceName);
	switch(resourceName)
	{
	case CResourceManager::COLUMN1:
		{
			_type = CResourceManager::TYPE_COLUMN1;
			break;
		}

	case CResourceManager::COLUMN2:
		{
			_type = CResourceManager::TYPE_COLUMN2;
			break;
		}

	case CResourceManager::MIDLAND:
		{
			_type = CResourceManager::TYPE_MIDLAND;
			break;
		}
	case CResourceManager::BARRIER:
		{
			_type = CResourceManager::TYPE_BARRIER;
			break;
		}
	case CResourceManager::CLOUD:
		{
			_type = CResourceManager::TYPE_CLOUD;
			break;
		}
	case CResourceManager::FLOWER:
		{
			_type = CResourceManager::TYPE_FLOWER;
			break;
		}
	case CResourceManager::GRASS:
		{
			_type = CResourceManager::TYPE_GRASS;
			break;
		}
	case CResourceManager::HIGHTREE:
		{
			_y += 7;
			_type = CResourceManager::TYPE_HIGHTREE;
			break;
		}
	case CResourceManager::SHORTTREE:
		{
			_y += 5;
			_type = CResourceManager::TYPE_SHORTTREE;
			break;
		}
	case CResourceManager::HOUSE:
		{
			_type = CResourceManager::TYPE_HOUSE;
			break;
		}
	case CResourceManager::MOUNTAIN:
		{
			_type = CResourceManager::TYPE_MOUNTAIN;
			break;
		}
	case CResourceManager::UPARROW:
		{
			_type = CResourceManager::TYPE_UPARROW;
			break;
		}
		
	}
}

Sight::~Sight()
{
	//delete _sprite;
}

void Sight::Render()
{
	Vector v = CScreen::getInstance()->getPosition();
	_sprite->Render(_x - v.getX(),_y - v.getY());
}

RECT Sight::getRect()
{
	int width,height;
	_sprite->getSize(width,height);

	RECT rec;
	rec.left = _x;
	rec.top = _y;
	rec.right = rec.left + width;
	rec.bottom = rec.top + height;

	return rec;
}
